package builder;

import java.util.Vector;

import model.Action;

public class AbstractFactoryBuilder extends AbstractPatternBuilder {

	private String client = "Client";
	private String concreteFactory1 = "ConcreteFactory1";
	private String concreteFactory2 = "ConcreteFactory2";
	private String productA1 = "ProductA1";
	private String productA2 = "ProductA2";
	private String productB1 = "ProductB1";
	private String productB2 = "ProductB2";
	private String abstractFactory = "AbstractFactory";
	private String abstractProductA = "AbstractProductA";
	private String abstractProductB = "AbstractProductB";
	
	public AbstractFactoryBuilder() {
		super();
	}

	@Override
	public Vector<Action> buildPattern() {
		
		this.buildClass(client);
		this.buildClass(concreteFactory1);
		this.buildClass(concreteFactory2);
		this.buildClass(productA1);
		this.buildClass(productA2);
		this.buildClass(productB1);
		this.buildClass(productB2);
		
		this.buildAbstractClass(abstractFactory);
		this.buildAbstractClass(abstractProductA);
		this.buildAbstractClass(abstractProductB);

		
		this.buildGeneralization(concreteFactory1,abstractFactory);
		this.buildGeneralization(concreteFactory2,abstractFactory);
		this.buildGeneralization(productA2,abstractProductA);
		this.buildGeneralization(productA1,abstractProductA);
		this.buildGeneralization(productB2,abstractProductB);
		this.buildGeneralization(productB1,abstractProductB);
		
		this.buildAssociation(client,abstractFactory);
		this.buildAssociation(client,abstractProductA);
		this.buildAssociation(client,abstractProductB);
		
		this.buildDependency(concreteFactory1, productA1);
		this.buildDependency(concreteFactory1, productB1);
		this.buildDependency(concreteFactory2, productA2);
		this.buildDependency(concreteFactory2, productB2);
		
		return patternActions;
	}

	@Override
	public void changeNames() {

		this.abstractFactory = names.get(0);
		this.concreteFactory1 = names.get(1);
		this.concreteFactory2 = names.get(2);
		this.abstractProductA = names.get(3);
		this.productA1 = names.get(4);
		this.productA2 = names.get(5);
		this.abstractProductB = names.get(6);
		this.productB1 = names.get(7);
		this.productB2 = names.get(8);
		this.client = names.get(9);

	}

	@Override
	public int cantUMLElements() {
		return 10;
	}

}
